import Loader from './loading'

export default {
  install: function(Vue, options) {
    const loader = new Loader()

    Vue.prototype.$webGlobal = {
      event: new Vue(),
      startLoading(msg) {
        loader.open({
          lock: true,
          text: msg || '处理中，请稍候',
          background: 'rgba(0, 0, 0, 0.3)'
        })
      },
      endLoading() {
        loader && loader.close()
      }
    }
  }
}
